package org.cn.osiris.system.listener;

import org.cn.osiris.system.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import javax.xml.ws.Action;

@WebListener
public class PermissionScanInitListener implements ServletContextListener {

    @Autowired
    private IPermissionService permissionService;

    /**
     * 上下文对象创建，自动调用
     * @param servletContextEvent
     */
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        System.out.println("扫描开启");
        permissionService.scanPermission();
        System.out.println("扫描结束");
    }

    /**
     * 上下文对象创建，自动调用
     * @param servletContextEvent
     */
    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
